/*   1:    */ package org.jetbrains.jps.model.serialization.artifact;
/*   2:    */ 
/*   3:    */

import com.intellij.openapi.util.JDOMUtil;
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
import com.intellij.util.xmlb.XmlSerializer;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementReference;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.artifact.*;
import org.jetbrains.jps.model.artifact.elements.*;
import org.jetbrains.jps.model.library.JpsLibraryReference;
import org.jetbrains.jps.model.module.JpsModuleReference;
import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
import org.jetbrains.jps.model.serialization.library.JpsLibraryTableSerializer;

import java.util.Iterator;
import java.util.List;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */
/*  17:    */
/*  18:    */
/*  19:    */
/*  20:    */
/*  21:    */
/*  22:    */
/*  23:    */
/*  24:    */
/*  25:    */
/*  26:    */
/*  27:    */
/*  28:    */
/*  29:    */
/*  30:    */
/*  31:    */
/*  32:    */
/*  33:    */
/*  34:    */
/*  35:    */
/*  36:    */
/*  37:    */ 
/*  38:    */ public class JpsArtifactSerializer
/*  39:    */ {
/*  40: 38 */   private static JpsPackagingElementSerializer<?>[] a = { new ArtifactRootElementSerializer(), new DirectoryElementSerializer(), new ArchiveElementSerializer(), new FileCopyElementSerializer(), new DirectoryCopyElementSerializer(), new ExtractedDirectoryElementSerializer(), new LibraryFilesElementSerializer(), new ArtifactOutputElementSerializer() };
/*  41: 48 */   private static final JpsArtifactPropertiesSerializer<?>[] b = { new JpsArtifactDummyPropertiesSerializer("plain", DirectoryArtifactType.INSTANCE), new JpsArtifactDummyPropertiesSerializer("jar", JarArtifactType.INSTANCE) };
/*  42:    */   private static final String c = "element";
/*  43:    */   private static final String d = "id";
/*  44: 54 */   private static final SkipDefaultValuesSerializationFilters e = new SkipDefaultValuesSerializationFilters();
/*  45:    */   
/*  46:    */   public static void loadArtifacts(@NotNull JpsProject paramJpsProject, @Nullable Element paramElement)
/*  47:    */   {
/*  48: 58 */     if (paramJpsProject == null) {
/*  49: 58 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer", "loadArtifacts" }));
/*  50:    */     }
/*  51: 58 */     JpsArtifactService localJpsArtifactService = JpsArtifactService.getInstance();
/*  52: 59 */     for (Element localElement : JDOMUtil.getChildren(paramElement, "artifact"))
/*  53:    */     {
/*  54: 60 */       ArtifactState localArtifactState = (ArtifactState)XmlSerializer.deserialize(localElement, ArtifactState.class);
/*  55: 61 */       if (localArtifactState != null)
/*  56:    */       {
/*  57: 62 */         JpsArtifactPropertiesSerializer localJpsArtifactPropertiesSerializer = c(localArtifactState.getArtifactType());
/*  58: 63 */         a(paramJpsProject, localJpsArtifactService, localArtifactState, localJpsArtifactPropertiesSerializer);
/*  59:    */       }
/*  60:    */     }
/*  61:    */   }
/*  62:    */   
/*  63:    */   private static <P extends JpsElement> void a(JpsProject paramJpsProject, JpsArtifactService paramJpsArtifactService, ArtifactState paramArtifactState, JpsArtifactPropertiesSerializer<P> paramJpsArtifactPropertiesSerializer)
/*  64:    */   {
/*  65: 68 */     JpsPackagingElement localJpsPackagingElement = a(paramArtifactState.getRootElement());
/*  66:    */     JpsArtifact localJpsArtifact;
/*  67: 69 */     if (localJpsPackagingElement != null)
/*  68:    */     {
/*  69: 70 */       List localList = paramArtifactState.getPropertiesList();
/*  70: 71 */       localJpsArtifact = paramJpsArtifactService.addArtifact(paramJpsProject, paramArtifactState.getName(), (JpsCompositePackagingElement)localJpsPackagingElement, (JpsArtifactType)paramJpsArtifactPropertiesSerializer.getType(), paramJpsArtifactPropertiesSerializer.loadProperties(localList));
/*  71:    */       
/*  72: 73 */       localJpsArtifact.setBuildOnMake(paramArtifactState.isBuildOnMake());
/*  73: 74 */       localJpsArtifact.setOutputPath(paramArtifactState.getOutputPath());
/*  74: 75 */       for (ArtifactPropertiesState localArtifactPropertiesState : localList)
/*  75:    */       {
/*  76: 76 */         JpsArtifactExtensionSerializer localJpsArtifactExtensionSerializer = b(localArtifactPropertiesState.getId());
/*  77: 77 */         if (localJpsArtifactExtensionSerializer != null) {
/*  78: 78 */           a(localJpsArtifactExtensionSerializer, localJpsArtifact, localArtifactPropertiesState.getOptions());
/*  79:    */         }
/*  80:    */       }
/*  81:    */     }
/*  82:    */   }
/*  83:    */   
/*  84:    */   public static void saveArtifact(@NotNull JpsArtifact paramJpsArtifact, Element paramElement)
/*  85:    */   {
/*  86: 85 */     if (paramJpsArtifact == null) {
/*  87: 85 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer", "saveArtifact" }));
/*  88:    */     }
/*  89: 85 */     ArtifactState localArtifactState = new ArtifactState();
/*  90: 86 */     localArtifactState.setName(paramJpsArtifact.getName());
/*  91: 87 */     localArtifactState.setBuildOnMake(paramJpsArtifact.isBuildOnMake());
/*  92: 88 */     localArtifactState.setOutputPath(paramJpsArtifact.getOutputPath());
/*  93: 89 */     JpsArtifactPropertiesSerializer localJpsArtifactPropertiesSerializer = a(paramJpsArtifact.getArtifactType());
/*  94: 90 */     a(paramJpsArtifact, paramElement, localArtifactState, localJpsArtifactPropertiesSerializer);
/*  95:    */   }
/*  96:    */   
/*  97:    */   private static <P extends JpsElement> void a(JpsArtifact paramJpsArtifact, Element paramElement, ArtifactState paramArtifactState, JpsArtifactPropertiesSerializer<P> paramJpsArtifactPropertiesSerializer)
/*  98:    */   {
/*  99: 95 */     paramArtifactState.setArtifactType(paramJpsArtifactPropertiesSerializer.getTypeId());
/* 100: 96 */     paramArtifactState.setRootElement(a(paramJpsArtifact.getRootElement()));
/* 101: 97 */     List localList = paramArtifactState.getPropertiesList();
/* 102:    */     
/* 103: 99 */     paramJpsArtifactPropertiesSerializer.saveProperties(paramJpsArtifact.getProperties(), localList);
/* 104:100 */     for (JpsModelSerializerExtension localJpsModelSerializerExtension : JpsModelSerializerExtension.getExtensions()) {
/* 105:101 */       for (JpsArtifactExtensionSerializer localJpsArtifactExtensionSerializer : localJpsModelSerializerExtension.getArtifactExtensionSerializers())
/* 106:    */       {
/* 107:102 */         JpsElement localJpsElement = paramJpsArtifact.getContainer().getChild(localJpsArtifactExtensionSerializer.getRole());
/* 108:103 */         if (localJpsElement != null)
/* 109:    */         {
/* 110:104 */           ArtifactPropertiesState localArtifactPropertiesState = new ArtifactPropertiesState();
/* 111:105 */           localArtifactPropertiesState.setId(localJpsArtifactExtensionSerializer.getId());
/* 112:106 */           localArtifactPropertiesState.setOptions(a(localJpsArtifactExtensionSerializer, localJpsElement));
/* 113:107 */           localList.add(localArtifactPropertiesState);
/* 114:    */         }
/* 115:    */       }
/* 116:    */     }
/* 117:111 */     paramElement.addContent(XmlSerializer.serialize(paramArtifactState, e));
/* 118:    */   }
/* 119:    */   
/* 120:    */   private static <E extends JpsElement> void a(JpsArtifactExtensionSerializer<E> paramJpsArtifactExtensionSerializer, JpsArtifact paramJpsArtifact, Element paramElement)
/* 121:    */   {
/* 122:117 */     JpsElement localJpsElement = paramJpsArtifactExtensionSerializer.loadExtension(paramElement);
/* 123:118 */     paramJpsArtifact.getContainer().setChild(paramJpsArtifactExtensionSerializer.getRole(), localJpsElement);
/* 124:    */   }
/* 125:    */   
/* 126:    */   private static <E extends JpsElement> Element a(JpsArtifactExtensionSerializer<?> paramJpsArtifactExtensionSerializer, E paramE)
/* 127:    */   {
/* 128:123 */     Element localElement = new Element("options");
/* 129:    */     
/* 130:125 */     paramJpsArtifactExtensionSerializer.saveExtension(paramE, localElement);
/* 131:126 */     return localElement;
/* 132:    */   }
/* 133:    */   
/* 134:    */   private static <P extends JpsPackagingElement> Element a(P paramP)
/* 135:    */   {
/* 136:131 */     JpsPackagingElementSerializer localJpsPackagingElementSerializer = a(paramP.getClass());
/* 137:132 */     Element localElement = new Element("element").setAttribute("id", localJpsPackagingElementSerializer.getTypeId());
/* 138:133 */     localJpsPackagingElementSerializer.save(paramP, localElement);
/* 139:134 */     if ((paramP instanceof JpsCompositePackagingElement)) {
/* 140:135 */       for (JpsPackagingElement localJpsPackagingElement : ((JpsCompositePackagingElement)paramP).getChildren()) {
/* 141:136 */         localElement.addContent(a(localJpsPackagingElement));
/* 142:    */       }
/* 143:    */     }
/* 144:139 */     return localElement;
/* 145:    */   }
/* 146:    */   
/* 147:    */   @Nullable
/* 148:    */   private static JpsPackagingElement a(Element paramElement)
/* 149:    */   {
/* 150:144 */     JpsPackagingElement localJpsPackagingElement1 = b(paramElement);
/* 151:145 */     if ((localJpsPackagingElement1 instanceof JpsCompositePackagingElement)) {
/* 152:146 */       for (Element localElement : JDOMUtil.getChildren(paramElement, "element"))
/* 153:    */       {
/* 154:147 */         JpsPackagingElement localJpsPackagingElement2 = a(localElement);
/* 155:148 */         if (localJpsPackagingElement2 != null) {
/* 156:149 */           ((JpsCompositePackagingElement)localJpsPackagingElement1).addChild(localJpsPackagingElement2);
/* 157:    */         }
/* 158:    */       }
/* 159:    */     }
/* 160:153 */     return localJpsPackagingElement1;
/* 161:    */   }
/* 162:    */   
/* 163:    */   @Nullable
/* 164:    */   private static JpsPackagingElement b(Element paramElement)
/* 165:    */   {
/* 166:158 */     String str = paramElement.getAttributeValue("id");
/* 167:159 */     JpsPackagingElementSerializer localJpsPackagingElementSerializer = a(str);
/* 168:160 */     if (localJpsPackagingElementSerializer != null) {
/* 169:161 */       return localJpsPackagingElementSerializer.load(paramElement);
/* 170:    */     }
/* 171:163 */     return null;
/* 172:    */   }
/* 173:    */   
/* 174:    */   @Nullable
/* 175:    */   private static JpsPackagingElementSerializer<?> a(@NotNull String paramString)
/* 176:    */   {
/* 177:168 */     if (paramString == null) {
/* 178:168 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer", "findElementSerializer" }));
/* 179:    */     }
/* 180:    */     Object localObject2;
/* 181:168 */     for (localObject2 : a) {
/* 182:169 */       if (((JpsPackagingElementSerializer)localObject2).getTypeId().equals(paramString)) {
/* 183:170 */         return localObject2;
/* 184:    */       }
/* 185:    */     }
/* 186:173 */     for (??? = JpsModelSerializerExtension.getExtensions().iterator(); ((Iterator)???).hasNext();)
/* 187:    */     {
/* 188:173 */       JpsModelSerializerExtension localJpsModelSerializerExtension = (JpsModelSerializerExtension)((Iterator)???).next();
/* 189:174 */       for (localIterator = localJpsModelSerializerExtension.getPackagingElementSerializers().iterator(); localIterator.hasNext();)
/* 190:    */       {
/* 191:174 */         localObject2 = (JpsPackagingElementSerializer)localIterator.next();
/* 192:175 */         if (((JpsPackagingElementSerializer)localObject2).getTypeId().equals(paramString)) {
/* 193:176 */           return localObject2;
/* 194:    */         }
/* 195:    */       }
/* 196:    */     }
/* 197:    */     Iterator localIterator;
/* 198:180 */     return null;
/* 199:    */   }
/* 200:    */   
/* 201:    */   @NotNull
/* 202:    */   private static <E extends JpsPackagingElement> JpsPackagingElementSerializer<E> a(@NotNull Class<E> paramClass)
/* 203:    */   {
/* 204:185 */     if (paramClass == null) {
/* 205:185 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer", "findElementSerializer" }));
/* 206:    */     }
/* 207:    */     JpsPackagingElementSerializer localJpsPackagingElementSerializer;
/* 208:185 */     for (localJpsPackagingElementSerializer : a) {
/* 209:186 */       if (localJpsPackagingElementSerializer.getElementClass().isAssignableFrom(paramClass))
/* 210:    */       {
/* 211:188 */         JpsPackagingElementSerializer tmp74_72 = localJpsPackagingElementSerializer;
/* 212:188 */         if (tmp74_72 == null) {
/* 213:188 */           throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer", "findElementSerializer" }));
/* 214:    */         }
/* 215:188 */         return tmp74_72;
/* 216:    */       }
/* 217:    */     }
/* 218:191 */     for (??? = JpsModelSerializerExtension.getExtensions().iterator(); ((Iterator)???).hasNext();)
/* 219:    */     {
/* 220:191 */       JpsModelSerializerExtension localJpsModelSerializerExtension = (JpsModelSerializerExtension)((Iterator)???).next();
/* 221:192 */       for (localIterator = localJpsModelSerializerExtension.getPackagingElementSerializers().iterator(); localIterator.hasNext();)
/* 222:    */       {
/* 223:192 */         tmp74_72 = (JpsPackagingElementSerializer)localIterator.next();
/* 224:193 */         if (tmp74_72.getElementClass().isAssignableFrom(paramClass))
/* 225:    */         {
/* 226:195 */           JpsPackagingElementSerializer tmp189_187 = tmp74_72;
/* 227:195 */           if (tmp189_187 == null) {
/* 228:195 */             throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/serialization/artifact/JpsArtifactSerializer", "findElementSerializer" }));
/* 229:    */           }
/* 230:195 */           return tmp189_187;
/* 231:    */         }
/* 232:    */       }
/* 233:    */     }
/* 234:    */     Iterator localIterator;
/* 235:199 */     throw new IllegalArgumentException("Serializer not found for " + paramClass);
/* 236:    */   }
/* 237:    */   
/* 238:    */   @Nullable
/* 239:    */   private static JpsArtifactExtensionSerializer<?> b(String paramString)
/* 240:    */   {
/* 241:204 */     for (JpsModelSerializerExtension localJpsModelSerializerExtension : ) {
/* 242:205 */       for (JpsArtifactExtensionSerializer localJpsArtifactExtensionSerializer : localJpsModelSerializerExtension.getArtifactExtensionSerializers()) {
/* 243:206 */         if (localJpsArtifactExtensionSerializer.getId().equals(paramString)) {
/* 244:207 */           return localJpsArtifactExtensionSerializer;
/* 245:    */         }
/* 246:    */       }
/* 247:    */     }
/* 248:211 */     return null;
/* 249:    */   }
/* 250:    */   
/* 251:    */   private static JpsArtifactPropertiesSerializer<?> c(String paramString)
/* 252:    */   {
/* 253:    */     Object localObject2;
/* 254:215 */     for (localObject2 : b) {
/* 255:216 */       if (((JpsArtifactPropertiesSerializer)localObject2).getTypeId().equals(paramString)) {
/* 256:217 */         return localObject2;
/* 257:    */       }
/* 258:    */     }
/* 259:220 */     for (??? = JpsModelSerializerExtension.getExtensions().iterator(); ((Iterator)???).hasNext();)
/* 260:    */     {
/* 261:220 */       JpsModelSerializerExtension localJpsModelSerializerExtension = (JpsModelSerializerExtension)((Iterator)???).next();
/* 262:221 */       for (localIterator = localJpsModelSerializerExtension.getArtifactTypePropertiesSerializers().iterator(); localIterator.hasNext();)
/* 263:    */       {
/* 264:221 */         localObject2 = (JpsArtifactPropertiesSerializer)localIterator.next();
/* 265:222 */         if (((JpsArtifactPropertiesSerializer)localObject2).getTypeId().equals(paramString)) {
/* 266:223 */           return localObject2;
/* 267:    */         }
/* 268:    */       }
/* 269:    */     }
/* 270:    */     Iterator localIterator;
/* 271:227 */     return b[0];
/* 272:    */   }
/* 273:    */   
/* 274:    */   private static JpsArtifactPropertiesSerializer<?> a(JpsArtifactType paramJpsArtifactType)
/* 275:    */   {
/* 276:    */     Object localObject2;
/* 277:231 */     for (localObject2 : b) {
/* 278:232 */       if (((JpsArtifactPropertiesSerializer)localObject2).getType().equals(paramJpsArtifactType)) {
/* 279:233 */         return localObject2;
/* 280:    */       }
/* 281:    */     }
/* 282:236 */     for (??? = JpsModelSerializerExtension.getExtensions().iterator(); ((Iterator)???).hasNext();)
/* 283:    */     {
/* 284:236 */       JpsModelSerializerExtension localJpsModelSerializerExtension = (JpsModelSerializerExtension)((Iterator)???).next();
/* 285:237 */       for (localIterator = localJpsModelSerializerExtension.getArtifactTypePropertiesSerializers().iterator(); localIterator.hasNext();)
/* 286:    */       {
/* 287:237 */         localObject2 = (JpsArtifactPropertiesSerializer)localIterator.next();
/* 288:238 */         if (((JpsArtifactPropertiesSerializer)localObject2).getType().equals(paramJpsArtifactType)) {
/* 289:239 */           return localObject2;
/* 290:    */         }
/* 291:    */       }
/* 292:    */     }
/* 293:    */     Iterator localIterator;
/* 294:243 */     return null;
/* 295:    */   }
/* 296:    */   
/* 297:    */   private static class ArtifactRootElementSerializer
/* 298:    */     extends JpsPackagingElementSerializer<JpsArtifactRootElement>
/* 299:    */   {
/* 300:    */     public ArtifactRootElementSerializer()
/* 301:    */     {
/* 302:248 */       super(JpsArtifactRootElement.class);
/* 303:    */     }
/* 304:    */     
/* 305:    */     public JpsArtifactRootElement load(Element paramElement)
/* 306:    */     {
/* 307:253 */       return JpsPackagingElementFactory.getInstance().createArtifactRoot();
/* 308:    */     }
/* 309:    */     
/* 310:    */     public void save(JpsArtifactRootElement paramJpsArtifactRootElement, Element paramElement) {}
/* 311:    */   }
/* 312:    */   
/* 313:    */   private static class DirectoryElementSerializer
/* 314:    */     extends JpsPackagingElementSerializer<JpsDirectoryPackagingElement>
/* 315:    */   {
/* 316:    */     public DirectoryElementSerializer()
/* 317:    */     {
/* 318:263 */       super(JpsDirectoryPackagingElement.class);
/* 319:    */     }
/* 320:    */     
/* 321:    */     public JpsDirectoryPackagingElement load(Element paramElement)
/* 322:    */     {
/* 323:268 */       return JpsPackagingElementFactory.getInstance().createDirectory(paramElement.getAttributeValue("name"));
/* 324:    */     }
/* 325:    */     
/* 326:    */     public void save(JpsDirectoryPackagingElement paramJpsDirectoryPackagingElement, Element paramElement)
/* 327:    */     {
/* 328:273 */       paramElement.setAttribute("name", paramJpsDirectoryPackagingElement.getDirectoryName());
/* 329:    */     }
/* 330:    */   }
/* 331:    */   
/* 332:    */   private static class ArchiveElementSerializer
/* 333:    */     extends JpsPackagingElementSerializer<JpsArchivePackagingElement>
/* 334:    */   {
/* 335:    */     public ArchiveElementSerializer()
/* 336:    */     {
/* 337:279 */       super(JpsArchivePackagingElement.class);
/* 338:    */     }
/* 339:    */     
/* 340:    */     public JpsArchivePackagingElement load(Element paramElement)
/* 341:    */     {
/* 342:284 */       return JpsPackagingElementFactory.getInstance().createArchive(paramElement.getAttributeValue("name"));
/* 343:    */     }
/* 344:    */     
/* 345:    */     public void save(JpsArchivePackagingElement paramJpsArchivePackagingElement, Element paramElement)
/* 346:    */     {
/* 347:289 */       paramElement.setAttribute("name", paramJpsArchivePackagingElement.getArchiveName());
/* 348:    */     }
/* 349:    */   }
/* 350:    */   
/* 351:    */   private static class FileCopyElementSerializer
/* 352:    */     extends JpsPackagingElementSerializer<JpsFileCopyPackagingElement>
/* 353:    */   {
/* 354:    */     public FileCopyElementSerializer()
/* 355:    */     {
/* 356:295 */       super(JpsFileCopyPackagingElement.class);
/* 357:    */     }
/* 358:    */     
/* 359:    */     public JpsFileCopyPackagingElement load(Element paramElement)
/* 360:    */     {
/* 361:300 */       return JpsPackagingElementFactory.getInstance().createFileCopy(paramElement.getAttributeValue("path"), paramElement.getAttributeValue("output-file-name"));
/* 362:    */     }
/* 363:    */     
/* 364:    */     public void save(JpsFileCopyPackagingElement paramJpsFileCopyPackagingElement, Element paramElement)
/* 365:    */     {
/* 366:306 */       paramElement.setAttribute("path", paramJpsFileCopyPackagingElement.getFilePath());
/* 367:307 */       String str = paramJpsFileCopyPackagingElement.getRenamedOutputFileName();
/* 368:308 */       if (str != null) {
/* 369:309 */         paramElement.setAttribute("output-path-name", str);
/* 370:    */       }
/* 371:    */     }
/* 372:    */   }
/* 373:    */   
/* 374:    */   private static class DirectoryCopyElementSerializer
/* 375:    */     extends JpsPackagingElementSerializer<JpsDirectoryCopyPackagingElement>
/* 376:    */   {
/* 377:    */     public DirectoryCopyElementSerializer()
/* 378:    */     {
/* 379:316 */       super(JpsDirectoryCopyPackagingElement.class);
/* 380:    */     }
/* 381:    */     
/* 382:    */     public JpsDirectoryCopyPackagingElement load(Element paramElement)
/* 383:    */     {
/* 384:321 */       return JpsPackagingElementFactory.getInstance().createDirectoryCopy(paramElement.getAttributeValue("path"));
/* 385:    */     }
/* 386:    */     
/* 387:    */     public void save(JpsDirectoryCopyPackagingElement paramJpsDirectoryCopyPackagingElement, Element paramElement)
/* 388:    */     {
/* 389:326 */       paramElement.setAttribute("path", paramJpsDirectoryCopyPackagingElement.getDirectoryPath());
/* 390:    */     }
/* 391:    */   }
/* 392:    */   
/* 393:    */   private static class ExtractedDirectoryElementSerializer
/* 394:    */     extends JpsPackagingElementSerializer<JpsExtractedDirectoryPackagingElement>
/* 395:    */   {
/* 396:    */     public ExtractedDirectoryElementSerializer()
/* 397:    */     {
/* 398:333 */       super(JpsExtractedDirectoryPackagingElement.class);
/* 399:    */     }
/* 400:    */     
/* 401:    */     public JpsExtractedDirectoryPackagingElement load(Element paramElement)
/* 402:    */     {
/* 403:338 */       return JpsPackagingElementFactory.getInstance().createExtractedDirectory(paramElement.getAttributeValue("path"), paramElement.getAttributeValue("path-in-jar"));
/* 404:    */     }
/* 405:    */     
/* 406:    */     public void save(JpsExtractedDirectoryPackagingElement paramJpsExtractedDirectoryPackagingElement, Element paramElement)
/* 407:    */     {
/* 408:344 */       paramElement.setAttribute("path", paramJpsExtractedDirectoryPackagingElement.getFilePath());
/* 409:345 */       paramElement.setAttribute("path-in-jar", paramJpsExtractedDirectoryPackagingElement.getPathInJar());
/* 410:    */     }
/* 411:    */   }
/* 412:    */   
/* 413:    */   private static class LibraryFilesElementSerializer
/* 414:    */     extends JpsPackagingElementSerializer<JpsLibraryFilesPackagingElement>
/* 415:    */   {
/* 416:    */     public LibraryFilesElementSerializer()
/* 417:    */     {
/* 418:351 */       super(JpsLibraryFilesPackagingElement.class);
/* 419:    */     }
/* 420:    */     
/* 421:    */     public JpsLibraryFilesPackagingElement load(Element paramElement)
/* 422:    */     {
/* 423:356 */       String str1 = paramElement.getAttributeValue("level");
/* 424:357 */       String str2 = paramElement.getAttributeValue("name");
/* 425:358 */       String str3 = paramElement.getAttributeValue("module-name");
/* 426:    */       Object localObject;
/* 427:360 */       if (str3 != null) {
/* 428:361 */         localObject = JpsElementFactory.getInstance().createModuleReference(str3);
/* 429:    */       } else {
/* 430:364 */         localObject = JpsLibraryTableSerializer.createLibraryTableReference(str1);
/* 431:    */       }
/* 432:366 */       return JpsPackagingElementFactory.getInstance().createLibraryElement(JpsElementFactory.getInstance().createLibraryReference(str2, (JpsElementReference)localObject));
/* 433:    */     }
/* 434:    */     
/* 435:    */     public void save(JpsLibraryFilesPackagingElement paramJpsLibraryFilesPackagingElement, Element paramElement)
/* 436:    */     {
/* 437:372 */       JpsLibraryReference localJpsLibraryReference = paramJpsLibraryFilesPackagingElement.getLibraryReference();
/* 438:373 */       JpsElementReference localJpsElementReference = localJpsLibraryReference.getParentReference();
/* 439:374 */       paramElement.setAttribute("level", JpsLibraryTableSerializer.getLevelId(localJpsElementReference));
/* 440:375 */       paramElement.setAttribute("name", localJpsLibraryReference.getLibraryName());
/* 441:376 */       if ((localJpsElementReference instanceof JpsModuleReference)) {
/* 442:377 */         paramElement.setAttribute("module-name", ((JpsModuleReference)localJpsElementReference).getModuleName());
/* 443:    */       }
/* 444:    */     }
/* 445:    */   }
/* 446:    */   
/* 447:    */   private static class ArtifactOutputElementSerializer
/* 448:    */     extends JpsPackagingElementSerializer<JpsArtifactOutputPackagingElement>
/* 449:    */   {
/* 450:    */     public ArtifactOutputElementSerializer()
/* 451:    */     {
/* 452:384 */       super(JpsArtifactOutputPackagingElement.class);
/* 453:    */     }
/* 454:    */     
/* 455:    */     public JpsArtifactOutputPackagingElement load(Element paramElement)
/* 456:    */     {
/* 457:389 */       return JpsPackagingElementFactory.getInstance().createArtifactOutput(JpsArtifactService.getInstance().createReference(paramElement.getAttributeValue("artifact-name")));
/* 458:    */     }
/* 459:    */     
/* 460:    */     public void save(JpsArtifactOutputPackagingElement paramJpsArtifactOutputPackagingElement, Element paramElement)
/* 461:    */     {
/* 462:395 */       paramElement.setAttribute("artifact-name", paramJpsArtifactOutputPackagingElement.getArtifactReference().getArtifactName());
/* 463:    */     }
/* 464:    */   }
/* 465:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.serialization.artifact.JpsArtifactSerializer

 * JD-Core Version:    0.7.0.1

 */